﻿using Mt.Site.Application.Members.Dto.FrontEnd;
using Mt.Site.Core.Members;
using System.Threading.Tasks;

namespace Mt.Site.Application.Members
{
    public interface IMemberFrontEndAppService:IFrontEndAppService
    {
        /// <summary>
        /// 登陆
        /// </summary>
        /// <returns></returns>
        Task<ResultType> Login(LoginDto input);

        /// <summary>
        /// 会员注册之邮箱认证
        /// </summary>
        /// <param name="input"></param>
        /// <returns>0: 用户不存在， 1:成功， 2:邮件发送失败 ，5: 账号被冻结，其他:报错信息</returns>
        Task<string> Verification(VerificationDto input);

        /// <summary>
        /// 忘记密码的邮件发送
        /// </summary>
        /// <param name="input"></param>
        /// <returns>0: 用户不存在， 1:成功， 2:邮件发送失败 ，5: 账号被冻结</returns>
        Task<ForgetDtoOut> Forget(ForgetDto input);
        /// <summary>
        /// 重置找回秘密
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<ResultType> ResetPassword(ResetPasswordDto input);
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<ResultType> ChangePassword(ChangePasswordDto input);

        /// <summary>
        /// 校验email和用户名
        /// </summary>
        /// <param name="emailOrUserName"></param>
        /// <returns></returns>
        Task<bool> CheckIsExistEmailOrUserName(string emailOrUserName);

        /// <summary>
        /// 获取用户邮箱
        /// </summary>
        /// <param name="EmailOrUsername"></param>
        /// <returns></returns>
        Task<string> GetEamil(string EmailOrUsername);

        /// <summary>
        /// 登出
        /// </summary>
        void Logout();

        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="input"></param>
        Task<ResultType> RegisterMember(RegisterMemberDto input);

        /// <summary>
        /// 修改用户资料
        /// </summary>
        /// <param name="input"></param>
        Task<ResultType> UpdateMemberInfo(UpdateMemberInfoFrontEndDto input);
        Task<ResultType> ChangeEmail(ChangeEmailDto input);
        Task<ResultType> ChangeUserName(ChangeUserNameDto input);

        /// <summary>
        /// 获取用户资料
        /// </summary>
        /// <returns></returns>
        Task<MemberInfoDto> GetMemberInfo(MemberCacheItem memberCacheItem);

        /// <summary>
        /// 获取用户登陆信息缓存（可用于判别用户是否登陆）
        /// </summary>
        /// <returns></returns>
        Task<MemberCacheItem> GetMemberCacheItem();
    }
}
